


const pages = import.meta.glob("../views/**/page.js", {
    eager: true,
    import: "default"
})

const pageComps = import.meta.glob("../views/**/index.vue")

const viewsRoutes = Object.entries(pages).map(([path, meta]) => {
    const pageJSPath = path;
    path = path.replace('../views', '').replace("/page.js", '');
    path = path || '/';
    const name = path.split('/').filter(Boolean).join('_') || 'index'
    const comPath = pageJSPath.replace("page.js", 'index.vue')
    return {
        path,
        name,
        component: pageComps[comPath],
        meta,
    }
})

export default viewsRoutes
